<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>查看文件</title>
    <script src="../jq/jquery-1.11.3.js"></script>
    <script src="../jq/jquery-3.2.1.js"></script>
</head>
<body>
    <div>我上传的文件,点击查看（下载）</div>
    <ul id="file-list">
        <li>文件1</li>
        <li>文件2</li>
    </ul>
</body>
<script type="text/javascript">
    function showFile(){
        var url = "../file/showFile.do";
        console.log(url);
        $.ajax({
            "url" : url,
            "type" : "post",
            "dataType" : "json",
            "success" : function (json) {
                $("#file-list").empty();
                var fileList = json.data;
                console.log(fileList);
                for(var i=0;i<fileList.length;i++){
                    var html = "<li><a href='../upload/"+ fileList[i].fileName +"'>"+fileList[i].fileName+"</a></li>";
                    $("#file-list").append(html);
                }
            }
        });
    }

    $(document).ready(function () {
        showFile();
    })
</script>
</html>